

export default{

  getRole(code,rolelist,isSystemAdministrator)
{
    if(isSystemAdministrator==true)
    {
      return 8;
    }

  if(rolelist.length==0)
  {
    return 0;
  }
  let rolePkId = 0;
  let roleFlag = 0;
  // console.log(rolelist)
  for(let roleItem of rolelist)
  {
    if(roleItem["subjectPkId"] == code || code == null)
    {
      rolePkId = roleItem["rolePkId"];
      if(rolePkId=="5c0276bedf27472bb5678f89cf160d11" && roleFlag != 1 && roleFlag != 3 && roleFlag != 5 && roleFlag != 7 && roleFlag != 8)  //采集人员
      {
        roleFlag += 1;
      }
      if(rolePkId=="c6ddd825e7e6499187e467259a9de449" && roleFlag != 2 && roleFlag != 3 && roleFlag != 6 && roleFlag != 7 && roleFlag != 8)  //队列课题管理员
      {
        roleFlag += 2;
      }
      if(rolePkId=="25b81ce079e648b2a295d6d764167566" && roleFlag != 4 && roleFlag != 5 && roleFlag != 6 && roleFlag != 7 && roleFlag != 8)  //分中心
      {
        roleFlag += 4;
      }
      if(rolePkId=="716a43e5f81f4f2185dda3542e4765de" && roleFlag != 8)  //系统总管理员
      {
        roleFlag = 8;
      }
    }
  }
  console.log("权限是：" + roleFlag)
  return roleFlag;
},

  getSite(code,rolelist)
  {
    if(rolelist.length==0)
    {
      return -1;
    }
    let site = -1;
    for(let roleItem of rolelist)
    {
      if(roleItem["subjectPkId"]==code)
      {
        site = roleItem["sitePkId"];
        return site;
      }

    }
    return site;
  }
}

